package timer;

/**
 * 
 * 
 * @author Minodor
 * 
 *         DayTime in seconds 86400- 24h x 60 Min x 60 Sec
 */
public class Timer {
	public static int getMaxTime() {
		return 86400;
	}

	public static int getMinTime() {
		return 0;
	}

	public static Timer getTimer(String s) {
		int hours, minutes, seconds;
		try{
		hours = Integer.parseInt(s.substring(0, 2));
		minutes = Integer.parseInt(s.substring(3, 5));
		seconds = Integer.parseInt(s.substring(6));
		
		Timer t = new Timer(hours * 3600 + minutes * 60 + seconds);
		return t;
		}
		catch (Exception e)
		{
			return null;
		}
	}

	int currentTime = 0;

	public Timer() {
		currentTime = 0;
	}

	public Timer(int time) {
		currentTime = time;
	}

	public int getTime() {
		return this.currentTime;
	}

	@Override
	public String toString() {
		return "Timer: " + currentTime + " = " + (currentTime / 3600) + ":"
				+ (currentTime / 60) % 60 + ":" + (currentTime % 60);
	}

}
